<template>
  <div>
    <Header_h />
    <div class="sq_box_content">
      <bannerInfo :info="info" />
    </div>
    <div class="new_box">
      <div class="container">
        <div class="s_flex s_align_items_start">
          <div style="width: 100%">
            <section class="core_content_left core_content">
              <div class="finance_item">
                <div class="leader_heads">
                  <div class="
                      s_flex s_justify_content_between s_align_items_center
                    ">
                    <div class="associatiob_company">
                      <el-tag v-if="list.tag" size="small" class="tag_right" effect="plain">{{ list.tag }}</el-tag>
                      {{ list.company }}
                    </div>
                    <div class="sq_sign_btn" @click="getUrl(list)">
                      立即联系
                    </div>
                  </div>
                  <div class="sq_content_color sq_content line_h_26">
                    <p>邮箱：{{ list.email }}</p>
                    <p>网址：{{ list.web_url }}</p>
                    <p>地址：{{ list.address }}</p>
                  </div>
                </div>
                <div class="leader_infos">
                  <div class="leader_heads">
                    <div class="sq_tilte_color ft_weight_800">
                      <div class="s_flex s_align_items_center">
                        <span class="r_line"></span>
                        <h3>概述:</h3>
                      </div>
                    </div>
                    <div class="sq_html sq_content line_h_26 sq_content_color" v-html="list.content"></div>
                  </div>
                </div>
              </div>
            </section>
          </div>
        </div>
      </div>
    </div>
    <Footer />
    <rightMenu @moveTo="moveTo" />

    <signUp :dialogVisible="dialogVisible" @handleClose="handleClose" @submit="submit" :text="text" />
  </div>
</template>

<script>
import Header_h from "@/components/Header_h";
import Footer from "@/components/Footer";
import bannerInfo from "@/components/web/bannerInfo";
import { consultAdd, overseassmartinfo } from "@/api/web";
import signUp from "@/components/web/signUp";
import rightMenu from "@/components/web/rightMenu";
import { PAGE_BASE_URL } from "@/config";

export default {
  components: {
    Header_h,
    Footer,
    bannerInfo,
    signUp,
    rightMenu,
  },
  data() {
    return {
      info: {
        title: "海外智联体",
        content: "海外知识产权事务所名录库",
        img: require("@/assets/web/banner.png"),
      },
      list: [],
      banner: [],
      check: -1,
      dialogVisible: false,
      text: {
        title: "咨询",
        btn: "立即咨询",
      },
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    moveTo() {
      window.scrollTo(0, 0);
    },
    async getList() {
      try {
        this.list = await overseassmartinfo({
          overseas_smart_id: this.$route.query.id,
        });
      } catch (error) {
        this.$message.error(error.message);
      }
    },
    goNews(id) {
      this.$router.push({ path: "/web/news/details", query: { id: id } });
    },
    webUrl(url) {
      window.open(url);
    },
    enter(index) {
      this.check = index;
    },
    leave() {
      this.check = -1;
    },
    checkItem(index) {
      this.active = index;
    },
    async handleClose() {
      this.dialogVisible = false;
    },
    async submit(form) {
      try {
        await consultAdd({
          ...form,
          from: this.url,
        });
        this.$message.success("提交成功");
      } catch (error) {
        this.$message.error(error.message);
      }
      this.dialogVisible = false;
    },
    getUrl(item) {
      this.url = `${PAGE_BASE_URL}/#/association/details?id=${item.id}`;
      this.dialogVisible = true;
    },
  },
};
</script>

<style lang="less" scoped>
.new_box {
  margin-top: -4%;
  position: relative;
  z-index: 1;
  margin-bottom: 60px;
}

.core_content .item_list_img {
  width: 240px;
  object-fit: cover;
  overflow: hidden;

  .img_wap {
    padding-bottom: 56%;
    width: 100%;
    position: relative;

    img {
      width: 100%;
      transition: all 0.5s ease;

      &:hover {
        transform: scale(1.1);
      }
    }
  }
}

.li_active {
  width: 100%;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
  border: none;
}

.right_info {
  width: 75%;
  // margin-left: 25px;
}

.core_content .item_list {
  border-bottom: 1px solid #eee;
  padding: 23px 15px;
  width: 100%;
  margin: 30px auto 0;
  background: #ffffff;
  border: 1px solid #ced4ea;
  cursor: pointer;
  transition: all 0.2s ease;
}

// .core_content .item_list:last-child {
//   margin-bottom: 0;
// }

.content_spacing {
  // margin:0 auto 10px;
}

.core_content_left {
  width: 100%;
  background-color: #fff;
  height: 100%;
}

.core_content_right {
  width: 25%;
  background-color: #fff;
}

.content_right_spacing {
  margin: 10px 0;
}

.list_right {
  border-top: 1px solid #eee;
  padding: 10px 0;
  margin: 0 10px;
}

.right_title {
  margin: 0 10px;
  padding: 10px 0;
}

.finance_item {
  padding: 30px;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
  margin-bottom: 70px;

  p {
    margin-top: 10px;
  }

  .sq_sign_btn {
    margin-top: 10px;
  }

  h4 {
    margin-top: 10px;
  }
}

.leader_infos {
  margin-top: 50px;

  .r_line {
    width: 5px;
    height: 16px;
    line-height: 30px;
    background: #ca0010;
    box-shadow: 1px 2px 4px 0px rgba(251, 79, 79, 0.35);
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
  }
}

.leader_heads {
  padding: 0 30px;
}

.sq_html {
  border-top: 1px solid var(--color9);
  // border-bottom: 1px solid var(--color9);
  padding: 30px 0;
  margin-top: 25px;

  /deep/ img {
    max-width: 100%;
    margin: 0 auto;
  }
}

.tag_right {
  margin-right: 10px;
}

@media (max-width: 750px) {
  .finance_item {
    padding: 30px 15px;
    margin-bottom: 0;
  }

  .leader_heads {
    padding: 0;
  }

  .associatiob_company {
    width: 55%;
  }
}
</style>